<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    String.prototype.Myrepeat = function(times)
    {
        if(typeof times!=='number'||!isFinite(times)||Math.floor(times)!=times)
        {
            throw new Error("times类型不对");
        }
        
        let result = '';
        for(let i = 0;i<times;i++)
        {
           result+=this;
        }

        return result;
    }

    const str = 'abc';
    const newStr = str.Myrepeat(4);
    console.log(newStr);
</script>
<body>
    
</body>
</html>